package doctor

import (
	"github.com/bgmp/config"
	"github.com/bgmp/handler"
	"github.com/bgmp/middleware"
	"github.com/bgmp/model"
	"github.com/gin-gonic/gin"
)

func (b Base) AddPatients(c *gin.Context, req *AddPatientsRequest) *AddPatientsResponse {
	user, err := middleware.GetDoctor(c)
	if err != nil {
		handler.Errorf(c, err.Error())
		return nil
	}
	tr := model.TherapeuticRelationship{
		Doctor:   user.ID,
		Patients: req.Patients,
	}
	err = tr.Add(config.DB)
	if err != nil {
		handler.Errorf(c, err.Error())
		return nil
	}
	return &AddPatientsResponse{}
}

type AddPatientsRequest struct {
	Patients []uint `json:"patients"`
}

type AddPatientsResponse struct {
}
